<layout name="layout"/>

<div class="pageheader notab">
    <h1 class="pagetitle">
        <a href="/" class="linkWay">首页</a>
        &nbsp;<span class="divider">»</span>&nbsp;

        <switch name="driver_type">
            <case value="attracted">
                <a href="/promote/attracted" class="linkWay">全店低价引流</a>
            </case>
            <case value="wireless">
                <a href="/promote/wireless" class="linkWay">无线养分</a>
            </case>
            <case value="quick">
                <a href="/promote/quick" class="linkWay">自动低价测款</a>
            </case>
        </switch>

        &nbsp;<span class="divider">»</span>&nbsp;
        <a href="#" class="currentWay">正在初始化自动开车</a>
    </h1>
</div>

<div id="contentwrapper" class="contentwrapper">
    <div id="auto_status_wrapper">
        <empty name="unfinished_adgroups">
            <div class="info">当前没有正在进行推广的宝贝</div>
        <else/>
            <table cellspacing="0" cellpadding="0" border="0" class="metrotable" id="table1">
                <colgroup>
                    <col class="con1" style="width:30%;">
                    <col class="con0" style="width:20%;">
                    <col class="con1" style="width:15%;">
                    <col class="con1" style="width:15%;">
                    <col class="con0" style="width:20%;">
                </colgroup>
                <thead>
                <tr>
                    <th class="head1">推广宝贝</th>
                    <th class="head0">当前状态</th>
                    <th class="head1">推广时间</th>
                    <th class="head1">目前进度</th>
                    <th class="head0">操作</th>
                </tr>
                </thead>
                <tbody>
                <volist name="unfinished_adgroups" id="v">
                    <tr id="product_{$v.product_id}_{$v.campaign_id}"
                        rel="<if condition='($v.status eq 0) OR ($v.status eq 1)'>{$v.product_id}_{$v.campaign_id}</if>">
                        <td>
                            <ul class="listview">
                                <li style="cursor:auto;margin-bottom:0">
                                    <div class="icon">
                                        <img src="{$v.img_url1}">
                                    </div>

                                    <div class="data">
                                        <h4>{$v.title1}</h4>

                                        <div class="filed">
                                            所属推广计划: {$v.campaign_title}
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </td>

                        <td class="auto_status">
                            <if condition="$v.status eq 0">
                                <span class="label label-info">正在等待中</span>
                            </if>

                            <if condition="$v.status eq 1">
                                <span class="label label-info">正在智能分析中</span>
                            </if>

                            <if condition="$v.status eq 2">
                                <span class="label label-success">智能分析完成
                                    <if condition="$v.need_confirm eq 1">, 等待确认提交<else/>, 已在推广中</if>
                                </span>
                            </if>

                            <if condition="$v.status eq -1">
                                <span class="label label-important">失败:{$v.msg}</span>
                            </if>
                        </td>
                        <td>
                            {$v.addtime|display_date}
                        </td>
                        <td>
                            <div class="progress">
                                <div class="bar">
                                    <div class="value bluebar" style="width: {$v.progress}%;"></div>
                                </div>
                            </div>
                        </td>
                        <td class="center" id="oper_{$v.product_id}_{$v.campaign_id}">
                            <if condition="$v.status eq 2">
                                &nbsp;<a class="actionBtn" title="查看该推广" href="/adgroup/manage?adgroup_id={$v.adgroup_id}" target="_blank">查看</a>
                                <if condition="$v.need_confirm eq 1">
                                    &nbsp;<a class="actionBtn confirmButton" data-campaign-id="{$v.campaign_id}" data-product-id="{$v.product_id}" title="确认该推广" href="javascript:;;;;">确认</a>
                                    &nbsp;<a class="actionBtn deleteButton" data-campaign-id="{$v.campaign_id}" data-product-id="{$v.product_id}" title="删除该推广" href="javascript:;;;">删除</a>
                                </if>
                            </if>
                            <if condition="$v.status eq -1">
                                <a class="actionBtn deleteButton" title="删除该推广" data-campaign-id="{$v.campaign_id}" data-product-id="{$v.product_id}" href="javascript:;;;">删除</a>
                            </if>
                        </td>
                    </tr>
                </volist>
                </tbody>
            </table>
        </empty>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        promote.status($('.contentwrapper')).init();
    });
</script>
